package edu.scmu.controller;


import edu.scmu.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/resp")
public class ResponseController {

    @RequestMapping("/hello")
    @ResponseBody // 返回的内容是Json格式的字符串
    public List<User> hello(){
        System.out.println("hello");
        User user = new User();
        user.setName("zs");
        user.setAge(22);
        User user2 = new User();
        user2.setName("ls");
        user2.setAge(21);
        List<User> users = new ArrayList<User>();
        users.add(user);
        users.add(user2);
        return users;
//        return "hello";
    }

    @RequestMapping("/toLogin") // HTML页面
    public String toLogin(){
        System.out.println("hello");
        return "login"; //login.html
    }



}
